<template>
  <el-input
    v-if="isArticle<10"
    v-model="text"
    maxlength="30"
    placeholder="歌曲名称"
    show-word-limit
    type="text"
    @input="changeValue"
  />
  <el-input
  v-if="isArticle>10"
    v-model="text"
    maxlength="30"
    placeholder="标题"
    show-word-limit
    type="text"
    @input="changeValue"
  />
  <div style="margin: 20px 0" />
  <el-input
    v-model="textarea"
    maxlength="3000"
    placeholder="文章内容"
    show-word-limit
    type="textarea"
    @input="changeValue"
    v-if="isArticle>10"
  />
</template>

<script lang="ts" setup>
import { defineEmits,defineProps,toRefs } from 'vue'
import { ref } from 'vue'

//父组件向子组件传值
const props = defineProps({
  //子组件接收父组件传递过来的值
  isArticle: Number,
})
//使用父组件传递过来的值
const { isArticle } = toRefs(props)

const emit = defineEmits(['text','textarea'])
const text = ref('')
const textarea = ref('')

const  changeValue=()=>{
  emit('text',text)
  emit('textarea',textarea)
}

</script>